FROM edwinhuish/phalcon-php:3.4.5

ARG ENV_MODE=production

ARG CTN_PROJECT_DIR=/www

ARG TZ=Asia/Shanghai

RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && \
  echo ${TZ} > /etc/timezone && \
  usermod -u 1000 www-data && groupmod -g 1000 www-data && \
  mkdir -p ${CTN_PROJECT_DIR} && \
  chown www-data:www-data ${CTN_PROJECT_DIR} -R

COPY ./cron.d/course /etc/cron.d/course

RUN chmod 644 /etc/cron.d/course

RUN if [ "$ENV_MODE" != "production" ] ; then \
      pecl install xdebug && \
      docker-php-ext-enable xdebug ; \
    fi

WORKDIR ${CTN_PROJECT_DIR}

